package top.tsyz.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.tsyz.entity.OperationLog;
import top.tsyz.service.IOperationLogService;

import java.util.List;

/**
 * OperationLogController控制器
 */
@RestController
@RequestMapping("/api/operationLogs")
@Api(tags = "OperationLog管理接口")
public class OperationLogController {

    @Autowired
    private IOperationLogService ioperationlogservice;

    @GetMapping("/list")
    @ApiOperation("获取所有OperationLog")
    public List<OperationLog> list() {
        return ioperationlogservice.list();
    }

    @GetMapping("/{id}")
    @ApiOperation("根据ID获取OperationLog")
    public OperationLog getById(@PathVariable Long id) {
        return ioperationlogservice.getById(id);
    }

    @PostMapping
    @ApiOperation("新增OperationLog")
    public boolean save(@RequestBody OperationLog operationlog) {
        return ioperationlogservice.save(operationlog);
    }

    @PutMapping
    @ApiOperation("更新OperationLog")
    public boolean update(@RequestBody OperationLog operationlog) {
        return ioperationlogservice.updateById(operationlog);
    }

    @DeleteMapping("/{id}")
    @ApiOperation("删除OperationLog")
    public boolean delete(@PathVariable Long id) {
        return ioperationlogservice.removeById(id);
    }
}
